/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.delogic.simuladorbancario.main.controller;

import br.com.delogic.simuladorbancario.main.business.ClienteBusiness;
import br.com.delogic.simuladorbancario.main.model.Cliente;
import br.com.delogic.simuladorbancario.main.model.Sucesso;
import br.com.delogic.simuladorbancario.main.view.ClienteView;
import br.com.delogic.simuladorbancario.main.view.ConsultarClientesView;
import java.util.Arrays;

/**
 *
 * @author NB1
 */
public class AlterarERecarregarClienteController extends AlterarClienteController {
    private final ConsultarClientesView consultarClienteView;
    private Integer codigo;
    
    public AlterarERecarregarClienteController (ConsultarClientesView view) {
        this.consultarClienteView = view;
    }
    
    @Override
    public void salvar(ClienteView view) {
        Sucesso sucesso = clienteBusiness.alterarCliente(cliente);
        view.informarSucesso(sucesso);
        view.dispose();
        consultarClienteView.listarClientes(Arrays.asList(cliente));
    }

    @Override
    public void consultar(Integer codigo, ClienteView view) {
        cliente = clienteBusiness.consultarClientePorCodigo(codigo);
        view.mostrarCliente(cliente);
    }

    @Override
    public void bloquear(ClienteView view) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public void cancelar(ClienteView view) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public void reativar(ClienteView view) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
}
